package com.digitalchina.lxnsy.viewholder;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.LogisticsVO;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：白彦东
 * 创建时间：2016/12/28 18:10
 * 修改备注：
 * ================================================
 */

public class LogisticsHolder extends BaseViewHolder<LogisticsVO.LogisticsInfosBean> {

    private ImageView ivImage;
    private TextView tvTime;
    private TextView tvContent;


    public LogisticsHolder(ViewGroup parent) {
        super(parent, R.layout.item_logistics);
        ivImage = $(R.id.item_logistics_iv_tag);
        tvTime = $(R.id.item_logistics_tv_time);
        tvContent = $(R.id.item_logistics_tv_content);
    }

    @Override
    public void setData(LogisticsVO.LogisticsInfosBean data) {
        super.setData(data);

        if (getAdapterPosition() == 0) {
            ivImage.setBackgroundResource(R.drawable.ic_logistics_end);
            tvTime.setTextColor(getContext().getResources().getColor(R.color.colorRed));
            tvContent.setTextColor(getContext().getResources().getColor(R.color.colorRed));
        } else {
            ivImage.setBackgroundResource(R.drawable.ic_logistics_arrows);
            tvTime.setTextColor(getContext().getResources().getColor(R.color.colorFontBlack));
            tvContent.setTextColor(getContext().getResources().getColor(R.color.colorFontBlack));
        }

        tvTime.setText(data.getTime().replace(" ","\n"));
        tvContent.setText(data.getContext());

    }
}
